1 module countries_currencies_languages.structures;
2 
3 import std.typecons : Nullable;
4 
5 pure @safe:
6 
7 ///
8 struct Country {
9 	string name;
10 	UN unitedNations;
11 	Additional additional;
12 	ISO3166 iso3166;
13 }
14 
15 ///
16 struct ISO3166 {
17 	/// Alpha-2 codes from ISO 3166-1
18 	string alpha2;
19 	/// Alpha-3 codes from ISO 3166-1 (synonymous with World Bank Codes)
20 	string alpha3;
21 	string name;
22 	/// The 
23 	Nullable!string commonName;
24 	/// Numeric codes from ISO 3166-1
25 	long numeric;
26 	Nullable!string officialName;
27 	const(Subdivision)[] subdivision;
28 }
29 
30 /// UN == United Nations
31 struct UN {
32 	/// Country or Area official Arabic short name from UN Statistics Divsion
33 	string nameArabicOfficial;
34 	/// Country or Area official Spanish short name from UN Statistics Divsion
35 	string nameSpanishOfficial;
36 	/// Country or Area official English short name from UN Statistics Divsion
37 	string nameEnglishOfficial;
38 	/// Country or Area official Chinese short name from UN Statistics Divsion
39 	string nameChineseOfficial;
40 	/// Country or Area official French short name from UN Statistics Divsion
41 	string nameFrenchOfficial;
42 	/// Country or Area official Russian short name from UN Statistics Divsion
43 	string nameRussianOfficial;
44 	/// Country's formal Arabic name from UN Protocol and Liaison Service
45 	string nameArabicFormal;
46 	/// Country's formal Spanish name from UN Protocol and Liaison Service
47 	string nameSpanishFormal;
48 	/// Country's formal English name from UN Protocol and Liaison Service
49 	string nameEnglishFormal;
50 	/// Country's formal Chinese name from UN Protocol and Liaison Service
51 	string nameChineseFormal;
52 	/// Country's formal French name from UN Protocol and Liaison Service
53 	string nameFrenchFormal;
54 	/// Country's formal Russian name from UN Protocol and Liaison Service
55 	string nameRussianFormal;
56 	/// Country's short Arabic name from UN Protocol and Liaison Service
57 	string nameArabicShort;
58 	/// Country's short Spanish name from UN Protocol and Liaison Service
59 	string nameSpanishShort;
60 	/// Country's short English name from UN Protocol and Liaison Service
61 	string nameEnglishShort;
62 	/// Country's short Chinese name from UN Protocol and Liaison Service
63 	string nameChineseShort;
64 	/// Country's short French name from UN Protocol and Liaison Service
65 	string nameFrenchShort;
66 	/// Country's short Russian name from UN Protocol and Liaison Service
67 	string nameRussianShort;
68 	/// Country classification from United Nations Statistics Division
69 	string smallIslandDevelopingStates;
70 	/// Country classification from United Nations Statistics Division
71 	string landLockedDevelopingCountry;
72 	/// Global Administrative Unit Layers from the Food and Agriculture Organization
73 	string gaul;
74 	/** UN Statistics M49 numeric codes (nearly synonymous with ISO 3166-1 numeric 
75 	 * codes, which are based on UN M49. ISO 3166-1 does not include Channel 
76 	 * Islands or Sark, for example)
77 	 */
78 	Nullable!long m49;
79 	Location location;
80 	/// Country classification from United Nations Statistics Division
81 	CountryClassification countryClassification;
82 }
83 
84 ///
85 struct Location {
86 	/// Country classification from United Nations Statistics Division
87 	string subRegionName;
88 	/// Country classification from United Nations Statistics Division
89 	string regionName;
90 	/// Country classification from United Nations Statistics Division
91 	string subRegionCode;
92 	/// Country classification from United Nations Statistics Division
93 	string regionCode;
94 	/// Country classification from United Nations Statistics Division
95 	string intermediateRegionCode;
96 	/// Country classification from United Nations Statistics Division
97 	string intermediateRegionName;
98 	/// Country classification from United Nations Statistics Division
99 	string globalName;
100 	/// Country classification from United Nations Statistics Division
101 	string globalCode;
102 	/// Continent from Geonames
103 	string continent;
104 }
105 
106 ///
107 struct Additional {
108 	/// Capital city from Geonames
109 	string capital;
110 	/// Top level domain from Geonames
111 	string tld;
112 	/** Languages from Geonames, maps to the keys in the `Language`
113 	 * associative array.
114 	 * These can match the keys in the associative array received
115 	 * from getLanguages, also these can match ISO639.alpha3 or
116 	 * ISO639.alpha3Alternative.
117 	 */
118 	const(string)[] languages;
119 	/// Geoname ID
120 	Nullable!long geoNameId;
121 	/// Country's customary English short name (CLDR)
122 	string cldrDisplayName;
123 	/// EDGAR country code from SEC
124 	string edgarCode;
125 	/// Distinguishing signs of vehicles in international traffic
126 	string ds;
127 	/// Codes assigned by the International Olympics Committee
128 	string ioc;
129 	/// Codes assigned by the International Telecommunications Union
130 	string itu;
131 	/// Country code from ITU-T recommendation E.164, sometimes followed by area code
132 	string dial;
133 	/// Codes assigned by the Fédération Internationale de Football Association
134 	string fifa;
135 	/// Country abbreviations by the World Meteorological Organization
136 	string wmo;
137 	/// Codes from the U.S. standard FIPS PUB 10-4
138 	string fips;
139 	/// Country status, based on the CIA World Factbook
140 	string isIndependent;
141 	/// Machine-Readable Cataloging codes from the Library of Congress
142 	string marc;
143 	/// ISO 4217 currency alphabetic code
144 	const(string)[] currencies;
145 }
146 
147 ///
148 enum CountryClassification {
149 	Undefined,
150 	Developing, 
151 	Developed
152 }
153 
154 ///
155 struct Subdivision {
156 	string countryCode;
157 	string code;
158 	string name;
159 	string type;
160 	Nullable!string parent;
161 	Subdivision[] subdivision;
162 }
163 
164 ///
165 struct Language {
166 	string id;
167 	string formalName;
168 	string nativeName;
169 	string commonName;
170 
171 	/// This matches ISO639.alpha3 or ISO639.alpha3Alternative
172 	string iso639;
173 }
174 
175 ///
176 struct Currency {
177 	/// ISO 4217 currency alphabetic code
178 	string currencyCode;
179 	/// ISO 4217 country name
180 	string displayName;
181 	/// ISO 4217 currency number of minor units
182 	string minorUnitName;
183 	string symbol;
184 	int defaultFractionDigits;
185 	double roundingIncrement;
186 	/// ISO 4217 currency numeric code
187 	Nullable!int iso4217Code;
188 }
189 
190 ///
191 enum Scope {
192 	individualLanguages,
193 	macrolanguages,
194 	familiesAndGroups,
195 	specialCodes,
196 	reservedForLocalUse
197 }
198 
199 ///
200 enum Type {
201 	living,
202 	extinct,
203 	ancient,
204 	historical,
205 	constructed
206 }
207 
208 ///
209 struct ISO639 {
210 	string alpha2;
211 	string alpha3;
212 	string alpha3Alternative;
213 	string name;
214 	string inEnglish;
215 	string inFrench;
216 	Scope scope_;
217 	Type type;
218 	const(string)[] inventedNames;
219 }